UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ujdflA7qW42ll/f2HwipaPa5SQ6LmlV/eZmit1PibXE='
WHERE
key_id = 'fe59c38e68c1049fb220153bfb242afd1e6659b4e9da1d3b2a57480d2997ca42'
AND (
token = 'ujdflA7qW42ll/f2HwipaPa5SQ6LmlV/eZmit1PibXE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)