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