UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'IbEqDCRQm0CE7hNpLIXBe/TuWLr79Egaidktgs+gT+c=' 
WHERE 
  key_id = 'f863c859911a1c71d8cafbcc43ceb55b2b3a607bd6c28157d1f6cfde58ae5916' 
  AND (
    token = 'IbEqDCRQm0CE7hNpLIXBe/TuWLr79Egaidktgs+gT+c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044