UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'WtuFWSvfBQUwdh17sMSdxnhTJEctDHGLV8lfcFxXdn0='
WHERE
key_id = '0ef7fc68c9d5209a4a6a74843eec390143375817b56448d7de01d59321a82006'
AND (
token = 'WtuFWSvfBQUwdh17sMSdxnhTJEctDHGLV8lfcFxXdn0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)