UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ae48wMaXv8t8u0WvKr/uHs6+R45ifQ+uWgiZei5zKeA='
WHERE
key_id = '881a772bdd06d48f5803523aae39e347f66795cbd79421095857e596232924ff'
AND (
token = 'ae48wMaXv8t8u0WvKr/uHs6+R45ifQ+uWgiZei5zKeA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)