UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'x8YG0BQYhOS6/6jurjw7bASVi9bSRoeDkpoorK36+CI='
WHERE
key_id = '21fa79087ae3de664e48366a57793c0a9a176a65ba360127f5b388b447c69fac'
AND (
token = 'x8YG0BQYhOS6/6jurjw7bASVi9bSRoeDkpoorK36+CI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)