UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'T2zmbfBfyr5+4wuxEeAy8L9gO746MUtOF9y9w1xfpb0='
WHERE
key_id = '6154bb92e81cee0e1e9c0033cc08bcd1f01fcd564360a03bf808a0f49c0ed279'
AND (
token = 'T2zmbfBfyr5+4wuxEeAy8L9gO746MUtOF9y9w1xfpb0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)