UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6YJfQXKfWSVjL0yJuXVA818HjluIEUhWZ+d+wOkc4yQ=' 
WHERE 
  key_id = '372d58982c2f0808031addd0b52896fc7126b4428a438ea76eb18834b75570f5' 
  AND (
    token = '6YJfQXKfWSVjL0yJuXVA818HjluIEUhWZ+d+wOkc4yQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052