UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'sM6RtgfiY/55ueU0deSnlujpAbLMCL705+x3Gt6OL2M='
WHERE
key_id = 'bea40ccdd7593623f76a1701c8641240f462c4539b8a5da74fff65600a28a2cb'
AND (
token = 'sM6RtgfiY/55ueU0deSnlujpAbLMCL705+x3Gt6OL2M='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)