UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7mKh2M4Yadn9H+SvkJaEVlMtEeuU0nmgC9q1Iouyurc=' 
WHERE 
  key_id = '1c69c4f7ee300abaf6b94c950e2e525bc9fa5320f1d4436dc7d62dd3d1fd6577' 
  AND (
    token = '7mKh2M4Yadn9H+SvkJaEVlMtEeuU0nmgC9q1Iouyurc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029