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