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

Query time 0.00045