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