UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'S1xXwZes2X3w2vG5rqKkjg64/ZPhWYDNU9w9u6t4PAg='
WHERE
key_id = 'd3dfc987469c084be309796c4f95473b40ec24a9bae2122e3315bb8b6c7dce04'
AND (
token = 'S1xXwZes2X3w2vG5rqKkjg64/ZPhWYDNU9w9u6t4PAg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)