UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DGyC/5ADUAYXvCqbTUTR7EkUhISU0FuuE2YKVPBkSOc=' 
WHERE 
  key_id = 'e386b8e3b1e661ada90e196daa200fc390c8b92203223e3d2987c6d7135d0bc1' 
  AND (
    token = 'DGyC/5ADUAYXvCqbTUTR7EkUhISU0FuuE2YKVPBkSOc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040