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

Query time 0.00023