UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'USOfN18xXAhLjuLK6joo0TGqHvhkkvZY33KkyHoZ9OA='
WHERE
key_id = 'b9d6c66d999f7129552d816000def950090168bfaa504804dc28043ba57f18cc'
AND (
token = 'USOfN18xXAhLjuLK6joo0TGqHvhkkvZY33KkyHoZ9OA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)