UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'M0OTlm0QJxCnEcniM0SD7vwJdntS3pK4SgKY2TumdjI=' 
WHERE 
  key_id = '4a87c3b7c4b6aaf363242c0035b538dcdb77711b55c0a30c74c340d306be280c' 
  AND (
    token = 'M0OTlm0QJxCnEcniM0SD7vwJdntS3pK4SgKY2TumdjI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030