UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k0vE7BEbKKoZWePKOh6D/oaRH1wjoLi5qvLRIfJMxrU=' 
WHERE 
  key_id = 'b17c5906c0af32844bb95cabf92a11d0dd414262528cb03d898d6f4fadfa720b' 
  AND (
    token = 'k0vE7BEbKKoZWePKOh6D/oaRH1wjoLi5qvLRIfJMxrU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033