UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'phkb4oBwaECSnXYl6DDYDCEq7C470DwT4dpO4Lvyjdo='
WHERE
key_id = '4d5d2b8d2f0df8215acb951e3147695b9831c2a714c782a30479ec22ef7a58f2'
AND (
token = 'phkb4oBwaECSnXYl6DDYDCEq7C470DwT4dpO4Lvyjdo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)