UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'W1WI4X+pY9Y9FCzSZ4m/s1VS3rM+6tHdmgvtxYFtksg='
WHERE
key_id = 'cee7d69db384123674a3c29f9a87fb3bfea5dd297f15098e0234bfc76e90ee02'
AND (
token = 'W1WI4X+pY9Y9FCzSZ4m/s1VS3rM+6tHdmgvtxYFtksg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)