UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'D8/AmeOrAHCy9Zt9gqIO23tsO9mkw8ck3uyQoYUohqM='
WHERE
key_id = 'ab417ceb94826b0f2c33279d702c8f4c1fc862dfcf52ddcce30fc5cc482a96c5'
AND (
token = 'D8/AmeOrAHCy9Zt9gqIO23tsO9mkw8ck3uyQoYUohqM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)