UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'ofPX3yiyFVUyDdYpgW+HmnGKYqFC6HJSw+w7JuO+qpI='
WHERE
key_id = 'a48eb339aea3b596675766265b38b1748dd2b6557b02d267ead55467ed750161'
AND (
token = 'ofPX3yiyFVUyDdYpgW+HmnGKYqFC6HJSw+w7JuO+qpI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)