UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'guOPiGOSD/mHfhhh0IKrLwE58P5K2xWV4NEcTcCfpiM='
WHERE
key_id = 'a6d3969a455097579addafa233c0714c9ec67aa44bd7ebd1cc6b9fc44c1bc4ad'
AND (
token = 'guOPiGOSD/mHfhhh0IKrLwE58P5K2xWV4NEcTcCfpiM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)