UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '8FcsE6OCmzaLCM01PFi4fY86m9AlZI4Aszs8HJBnaRw='
WHERE
key_id = '288807643fa62098392b6b16f1a1f2fa89be21d8b1d35978ff88b1ae448a8f71'
AND (
token = '8FcsE6OCmzaLCM01PFi4fY86m9AlZI4Aszs8HJBnaRw='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)