UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'anOo77Lox7MYPDVDGLMjCFMPWlsH1kqBqGjf+TO+aCM=' 
WHERE 
  key_id = '0d1ddd74cc65a16eaa05aa945b0b65b521e9ababa8cab3fe9eafa4d4952874fe' 
  AND (
    token = 'anOo77Lox7MYPDVDGLMjCFMPWlsH1kqBqGjf+TO+aCM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047