UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sYuxrF+aJcK05zK87mJ2oagtiWaqe3j+FbfOSVRp99s='
WHERE
key_id = '2cfc60823291861cc838a8a05525891ad6816e59537d9980fb746e23c0a6e1bb'
AND (
token = 'sYuxrF+aJcK05zK87mJ2oagtiWaqe3j+FbfOSVRp99s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)