UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7idF5gQ6SVweLgmIggXL7LaRwlNyj0gikb2CBbmG8mo='
WHERE
key_id = 'a154eb789086ab96f252e91f50457535bc385d63c3faf96237388a46b05d1eb4'
AND (
token = '7idF5gQ6SVweLgmIggXL7LaRwlNyj0gikb2CBbmG8mo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)