UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LFZL3LjEhwKjQ59P4Amk9LFxTNzHaHteFi+d3EXpbv8=' 
WHERE 
  key_id = '85c7dd516a4527cd8dfd8131818540d23077801799c840ca70803ffc95cbc156' 
  AND (
    token = 'LFZL3LjEhwKjQ59P4Amk9LFxTNzHaHteFi+d3EXpbv8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047