UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'C5MYVkskXIZ8tN0ZvAtnkG4O2AY6za6w79jLpDxlxaI=' 
WHERE 
  key_id = '6f35e199e89f21f8160792ecf766df706d13310c85854ef24f23b16653d9200a' 
  AND (
    token = 'C5MYVkskXIZ8tN0ZvAtnkG4O2AY6za6w79jLpDxlxaI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034