UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mzM6Kp0ViZi44aaVw1/DXZJw1wBnjRNWlS20s4KE+i0='
WHERE
key_id = '18d4341b58631c80b762767303f72544a46cacf1d7f11204ce426bd3a8494f56'
AND (
token = 'mzM6Kp0ViZi44aaVw1/DXZJw1wBnjRNWlS20s4KE+i0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)