UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gKT4pjiKP00klML2sh1jSH2DfCarwomohaqyIv0Ln9Q='
WHERE
key_id = 'fd54c0757c81645f2b7fc4cff874b87ca2d3997e2916307a2be06cf326dedafc'
AND (
token = 'gKT4pjiKP00klML2sh1jSH2DfCarwomohaqyIv0Ln9Q='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)