UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'aS9N6cEnmJhQRIFRhT8e8H4322OKv5tRfGY/40mWa7I='
WHERE
key_id = 'cff9fb403124cb750120aae8d2b09ebed8f79cf8ee9aac86d51c4d7ecd72897a'
AND (
token = 'aS9N6cEnmJhQRIFRhT8e8H4322OKv5tRfGY/40mWa7I='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)