UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'akIegyb2Pi17qec2aeL5Qvx2mY/dMIFVufPpecTbTCk='
WHERE
key_id = 'fe7fef7573c87b5e84c6d8754b97d4e7ca7079b6fe7c5c7df9a698d9f3b721a2'
AND (
token = 'akIegyb2Pi17qec2aeL5Qvx2mY/dMIFVufPpecTbTCk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)